//
//  YMCreditLeaseHeaderView.swift
//  NewVersionDemo
//
//  Created by zeng on 2018/3/14.
//  Copyright © 2018年 youmy. All rights reserved.
//

import UIKit


class YMCreditLeaseHeaderView: UIView {

    @IBOutlet weak var brandBtn: UIButton!
    
    @IBOutlet weak var colourBtn: UIButton!
       
    var brandBtnBlock:((_ btn: UIButton)->())?
    
    var colourBtnBlock:((_ btn: UIButton)->())?
    
    var selBtn:UIButton?
    
    override func awakeFromNib() {
        super.awakeFromNib()
        
        self.frame = CGRect(x: 0, y: 64, width: UIScreen.main.bounds.width, height: 40)
    }
    
    @IBAction func brandBtnClickAction(_ sender: UIButton) {
        sender.isSelected = !sender.isSelected
        print("品牌")
        
        if (brandBtnBlock != nil) {
            brandBtnBlock?(sender)
        }
    }
    
    @IBAction func colourBtnClickAction(_ sender: UIButton) {
        sender.isSelected = !sender.isSelected
        print("成色")
        
        if (colourBtnBlock != nil) {
            colourBtnBlock?(sender)
        }
    }
}

extension YMCreditLeaseHeaderView {
    class func nibView() -> YMCreditLeaseHeaderView{
        return Bundle.main.loadNibNamed("YMCreditLeaseHeaderView", owner: nil, options: nil)?.first as! YMCreditLeaseHeaderView
    }
}
